package com.originalpoint.origin_server.service.Impl;


import com.originalpoint.origin_server.mapper.MerchatMapper;
import com.originalpoint.origin_server.pojo.Merchat;
import com.originalpoint.origin_server.service.MerchatService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
 *@作者:lhj
 *Service实现类
 *@Date:2023/07/02
 */
@Service
public class MerchatServiceImpl  implements MerchatService{


    @Resource
    private MerchatMapper merchatdao;


    /**
     根据MerId查询
     */
    public Object selectByMerId(Integer merId){
        return merchatdao.selectByMerId(merId);
    }


    /**
     根据MerId更新
     */
    public Integer updateByMerId(Merchat demo){
        return merchatdao.updateByMerId( demo);
    }



    /**
     根据MerId删除
     */
    public Integer deleteByMerId(Integer merId){
        return merchatdao.deleteByMerId(merId);
    }





    /**
     insert:(插入)
     */
    public Object insert(Merchat demo){
        merchatdao.insert(demo);
        return demo;
    }



    /**
     insertOrUpdate(插入或更新(根据主键或唯一索引更新，主键和唯一索引不会改变))
     */
    public Integer insertOrUpdate(Merchat demo){
        return merchatdao.insertOrUpdate(demo);
    }



    /**
     insertBath:(批量插入)
     */
    public Integer insertBatch(List<Merchat> list){
        return merchatdao.insertBatch(list);
    }



    /**
     insertOrUpdateBatch:(批量插入或更新)
     */
    public Integer insertOrUpdateBatch(List<Merchat> list){
        return merchatdao.insertOrUpdateBatch(list);
    }



    /**
     selectList:(根据参数查询集合)
     */
    public List<Merchat> selectList(Map<String,Object> param){
        int start = Integer.parseInt(param.get("pageSize").toString()) * (Integer.parseInt(param.get("pageNum").toString()) - 1);
        param.put("pageNum",start);
        return merchatdao.selectList(param);
    }



    /**
     selectCount:(根据集合查询数量)
     */
    public Long selectCount(Map<String,Object> param){
        return merchatdao.selectCount(param);
    }



}